package com.hyjr.common.enums;

public enum TaskStateEnum {
	WAIT("WAIT", "等待执行"), RUNNING("RUNNING", "执行中"), FINISHED("RUNNING", "执行完毕");

	private String key;
	private String value;

	private TaskStateEnum(String key, String value) {
		this.key = key;
		this.value = value;
	}

	// 根据key获取枚举
	public static TaskStateEnum getEnumByKey(String key) {
		if (null == key) {
			return null;
		}
		for (TaskStateEnum temp : TaskStateEnum.values()) {
			if (temp.getKey().equals(key)) {
				return temp;
			}
		}
		return null;
	}

	public String getKey() {
		return key;
	}

	public String getValue() {
		return value;
	}
}
